/*
 * author:tim
 * date:9.16
 */
class line;
class point
{
    private:
        int x;
        int y;

    public:
        point();
        point(int , int);
        friend int dist(line&, point&);
        friend int real_dist(line&, point&);
        friend void show_in_terminal(line&, point&);
        friend class binder1;
        ~point();

};
class line
{
    private:
        int a;
        int b;
        int c;

    public:
        line();
        line(int , int , int );
        friend int dist(line&, point&);
        friend int real_dist(line&, point&);
        friend void show_in_terminal(line&, point&);
        friend class binder1;
        ~line();
};

point::point(): x(0), y(0) {}
point::point(int x_, int y_): x(x_), y(y_) {}
point::~point() {}
line::line(): a(0), b(0), c(0) {}
line::line(int a_, int b_, int c_): a(a_), b(b_), c(c_) {}
line::~line() {}

int real_dist(line& myline, point& mypoint)
{
    return (double)(myline.a * mypoint.x
            + myline.b * mypoint.y
            + myline.c) / std::sqrt(
                    std::pow((double)myline.a, 2)
                    + std::pow((double)myline.b, 2)
                    );
}
int dist(line& myline, point& mypoint)
{
    return std::abs(real_dist(myline, mypoint));
}
void show_in_terminal(line& myline, point& mypoint)
{
    std::cout<<"-------------------------------\n"
        <<"The line is "<<myline.a<<"x + "<<myline.b<<"y + "<<myline.c<<" ;\n"
        <<"The point is ("<<mypoint.x<<", "<<mypoint.y<<") ;\n"
        <<"The dist is "<<dist(myline, mypoint)<<" .\n"
        <<"-------------------------------\n";
}
